import base64
from typing import List

import shortuuid
from peewee import JOIN

from afast_core.core_libs.captcha.cilent import generate_captcha
from afast_core.core_tools.jwt_helper import SimpleAuth
from infirmary_admin_src.infirmary_common.infirmary_controller import IAsyncSessionBaseController, IBaseController
from infirmary_admin_src.infirmary_common.infirmary_controller.rest_controller_with_depends import \
    RestControllerWithDepends
from fastapi import Request, Depends

from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.schemas import SchemaBase


class XParam(SchemaBase):
    '''
    账号密码登录参数
    '''
    pageNum: int = 1
    pageSize: int = 6


class IController(IBaseController):
    '''
    定制相关约束检测函数逻辑步序
    '''

    def __init__(self, *, request: Request,
                 schema_param: XParam,
                 ):
        super().__init__(request=request)
        # 入参参数
        # 入参参数
        self.schema_param = schema_param


@RestControllerWithDepends()
class SupportFeedbackQueryController(IController):

    def business_login(self):
        pass

        return {

            "pageNum": 1,
            "pageSize": 20,
            "total": 56,
            "pages": 3,
            "list": [{
                "feedbackId": 57,
                "feedbackContent": "123",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-27 09:04:23",
                "createTime": "2023-05-27 09:04:23"
            }, {
                "feedbackId": 56,
                "feedbackContent": "ssssssssssssssss",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-25 15:05:26",
                "createTime": "2023-05-25 15:05:26"
            }, {
                "feedbackId": 55,
                "feedbackContent": "111",
                "feedbackAttachment": [{
                    "fileId": 424,
                    "folderType": 4,
                    "fileName": "d2c6cb43abd74c228234800d170ff9f3.png",
                    "fileSize": 188410,
                    "fileType": "png",
                    "fileKey": "public/feedback/7fd9e1757f7748478c8006a0a94ae3c4_20230525133421_png",
                    "creatorId": 1,
                    "creatorName": "卓大",
                    "creatorUserType": 1,
                    "fileUrl": "https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/public/feedback/7fd9e1757f7748478c8006a0a94ae3c4_20230525133421_png",
                    "createTime": "2023-05-25 13:34:21"
                }],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-25 13:34:29",
                "createTime": "2023-05-25 13:34:29"
            }, {
                "feedbackId": 54,
                "feedbackContent": "这两个项目一直都是0的状态",
                "feedbackAttachment": [{
                    "fileId": 416,
                    "folderType": 4,
                    "fileName": "QQ截图20230522185822.png",
                    "fileSize": 93084,
                    "fileType": "png",
                    "fileKey": "public/feedback/c531a869c91a4e5ea723cec0324f180a_20230522175853_png",
                    "creatorId": 1,
                    "creatorName": "卓大",
                    "creatorUserType": 1,
                    "fileUrl": "https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/public/feedback/c531a869c91a4e5ea723cec0324f180a_20230522175853_png",
                    "createTime": "2023-05-22 17:58:53"
                }],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-22 17:59:12",
                "createTime": "2023-05-22 17:59:12"
            }, {
                "feedbackId": 53,
                "feedbackContent": "HHH",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-21 20:52:06",
                "createTime": "2023-05-21 20:52:06"
            }, {
                "feedbackId": 52,
                "feedbackContent": "dadada",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-16 13:51:34",
                "createTime": "2023-05-16 13:51:34"
            }, {
                "feedbackId": 51,
                "feedbackContent": "wftewfe",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-15 16:31:09",
                "createTime": "2023-05-15 16:31:09"
            }, {
                "feedbackId": 50,
                "feedbackContent": "xxx",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-13 19:29:40",
                "createTime": "2023-05-13 19:29:40"
            }, {
                "feedbackId": 49,
                "feedbackContent": "系统文档  更新日志  点开列表  弹出页  右上角不能关闭，只能右下角关闭，功能重复",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-09 16:18:13",
                "createTime": "2023-05-09 16:18:13"
            }, {
                "feedbackId": 48,
                "feedbackContent": "123123",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-09 13:39:13",
                "createTime": "2023-05-09 13:39:13"
            }, {
                "feedbackId": 47,
                "feedbackContent": "点击通知栏里面的通知，跳转到主页面之后，柱状图就覆盖饼图了，每次操作都是这样，但是在当前页面刷新一下之后问题就没有了",
                "feedbackAttachment": [{
                    "fileId": 372,
                    "folderType": 4,
                    "fileName": "smartAdmin.png",
                    "fileSize": 145265,
                    "fileType": "png",
                    "fileKey": "public/feedback/5a0393a4b6a342c1bacbf7f4c89b1f47_20230505084352_png",
                    "creatorId": 1,
                    "creatorName": "卓大",
                    "creatorUserType": 1,
                    "fileUrl": "https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/public/feedback/5a0393a4b6a342c1bacbf7f4c89b1f47_20230505084352_png",
                    "createTime": "2023-05-05 08:43:52"
                }],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-05 08:45:07",
                "createTime": "2023-05-05 08:45:07"
            }, {
                "feedbackId": 46,
                "feedbackContent": "1",
                "feedbackAttachment": [{
                    "fileId": 369,
                    "folderType": 4,
                    "fileName": "c5b1c866-8-6.png",
                    "fileSize": 17589,
                    "fileType": "png",
                    "fileKey": "public/feedback/5af6d6d51a0246328809f8624f5f500c_20230504142237_png",
                    "creatorId": 1,
                    "creatorName": "卓大",
                    "creatorUserType": 1,
                    "fileUrl": "https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/public/feedback/5af6d6d51a0246328809f8624f5f500c_20230504142237_png",
                    "createTime": "2023-05-04 14:22:37"
                }],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-04 14:22:41",
                "createTime": "2023-05-04 14:22:41"
            }, {
                "feedbackId": 45,
                "feedbackContent": "首页‘更新日志’中选择某个记录打开后，右上角关闭“X”点击无法关闭弹窗，必须要点击右下角的‘关闭’按钮才能关闭",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-04 10:50:40",
                "createTime": "2023-05-04 10:50:40"
            }, {
                "feedbackId": 44,
                "feedbackContent": "1.希望支持导入导出功能\n2.希望能支持动态配置定时任务以及动态加载配置文件",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-04 10:40:20",
                "createTime": "2023-05-04 10:40:20"
            }, {
                "feedbackId": 43,
                "feedbackContent": "图片哟",
                "feedbackAttachment": [{
                    "fileId": 368,
                    "folderType": 4,
                    "fileName": "微信图片_20230411151306.jpg",
                    "fileSize": 39268,
                    "fileType": "jpg",
                    "fileKey": "public/feedback/f79d1e3bf66849e6ae410be49cfdf192_20230503150632_jpg",
                    "creatorId": 1,
                    "creatorName": "卓大",
                    "creatorUserType": 1,
                    "fileUrl": "https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/public/feedback/f79d1e3bf66849e6ae410be49cfdf192_20230503150632_jpg",
                    "createTime": "2023-05-03 15:06:32"
                }],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-03 15:06:48",
                "createTime": "2023-05-03 15:06:48"
            }, {
                "feedbackId": 42,
                "feedbackContent": "aaaa",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-05-03 14:54:48",
                "createTime": "2023-05-03 14:54:48"
            }, {
                "feedbackId": 41,
                "feedbackContent": "菜单设置缓存，似乎不生效",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-04-27 17:14:06",
                "createTime": "2023-04-27 17:14:06"
            }, {
                "feedbackId": 40,
                "feedbackContent": "给角色所有页面权限，切换到该角色的用户，很多页面仍然提示没权限。",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-04-27 17:13:42",
                "createTime": "2023-04-27 17:13:42"
            }, {
                "feedbackId": 39,
                "feedbackContent": "太复杂化了",
                "feedbackAttachment": [],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-04-22 14:13:43",
                "createTime": "2023-04-22 14:13:43"
            }, {
                "feedbackId": 38,
                "feedbackContent": "---------",
                "feedbackAttachment": [{
                    "fileId": 333,
                    "folderType": 4,
                    "fileName": "微信图片_20230314101941.jpg",
                    "fileSize": 166918,
                    "fileType": "jpg",
                    "fileKey": "public/feedback/6d42095e7a644326b0f069fc1a45e7d5_20230421152836_jpg",
                    "creatorId": 1,
                    "creatorName": "卓大",
                    "creatorUserType": 1,
                    "fileUrl": "https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/public/feedback/6d42095e7a644326b0f069fc1a45e7d5_20230421152836_jpg",
                    "createTime": "2023-04-21 15:28:37"
                }],
                "userId": 1,
                "userName": "卓大",
                "userType": 1,
                "updateTime": "2023-04-21 15:28:38",
                "createTime": "2023-04-21 15:28:38"
            }],
            "emptyFlag": False
        }
